<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>登录-DW快手助手</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="../layuiadmin/style/login.css" media="all">
</head>

<body>
  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>DW快手助手-登录</h2>
      </div>
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="text" name="userName" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="userPass" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="login">登 入</button>
        </div>
      </div>
    </div>
  </div>

  <script src="../layuiadmin/layui/layui.js"></script>
  <script>
    layui.use(['form'], function() {
      var $ = layui.$,
        form = layui.form;

      //监听提交
      form.on('submit(login)', function(data) {
        $.post('', data.field, function(data, status) {
          if (status != 'success')
            layer.msg('有表情地提示', {
              icon: 6
            });
          if (status == 'success') {
            if (data.code == 0)
              layer.msg('登录成功', {
                icon: 6
              }, function() {
                if (data.url)
                  window.location.href = data.url;
                else
                  window.location.href = '/';
              });
            else
              layer.msg(data.msg, {
                icon: 5
              });
          }
        });
        return false;
      });
    });
  </script>
</body>

</html>